﻿@{
    ViewBag.Title = "List";
}

@using yiCommerce.Core
@using yiCommerce.Models.Tags
@model yiCommerce.Models.Tags.TagListModel





@{
    var pageInfo = (IPagedList<TagListItemModel>)Model.TagLists;

   
}

<div class="container">
    
    <h2>List</h2>

    @foreach (var tag in Model.TagLists)
    {
        <div>

            <a href="/statuses?t=@tag.TagName">
                @tag.TagName
            </a>
        </div>
    }

    <ul class="pagination">
        @for (var p = 0; p < pageInfo.TotalPages; p++)
        {

            <li><a href="@ShowHref(pageInfo.PageIndex, p)" @ShowPageClass(pageInfo.PageIndex, p)>@(p + 1)</a></li>
        }
    </ul>

</div>

@functions{ 
    public string ShowHref(int currentPage, int loopPageIndex)
    {
        if (loopPageIndex == currentPage)
        {
            return "#";
        }
        else
        {
            return "/tags/list?pageIndex=" + (loopPageIndex);
        }

    }

    public string ShowPageClass(int currentPage, int loopPageIndex)
    {
        if (loopPageIndex == currentPage)
        {
            return "class=\"active\"";
        }
        else
        {
            return string.Empty;
        }
    }
}